/*
 * Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
 * Etiam sed turpis ac ipsum condimentum ingilla. Maecenas magna.
 * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
 * Vestibulum commodo. Ut rhoncus gravida arcu.
 */

package cn.itenzo.common.validate;


import com.baidu.unbiz.fluentvalidator.FluentValidator;
import com.baidu.unbiz.fluentvalidator.Result;
import com.baidu.unbiz.fluentvalidator.ResultCollectors;

import java.util.Date;

public class TestValidate {

	/**
	 *  maven 依赖
	 * <dependency>
	 *		<groupId>com.baidu.unbiz</groupId>
	 *		<artifactId>fluent-validator</artifactId>
	 *		<version>1.0.5</version>
	 *	</dependency>
	 * @param args
	 */
	
	
	public static void main(String[] args) {
		Result ret = FluentValidator
				.checkAll().failOver()
				.on("360428197204082712",new IdCardValidate())			//校验身份证号码的合法性
				.on("333", new LengthValidate(3,3, "aaa"))	//校验字符串的长度
				.on("wq32wq@163com",new EmailValidate())				//校验邮箱号码
				.on("6225768774508871",new BankNoValidate())			//校验银行卡号
				.on("18500221123a",new TelValidate())					//校验国内的手机号
				.on("",new NotBlankValidate("name"))				//校验字符串不为空
				.on(new Date(),new FutureTimeValidate())				//校验是否是未来的时间
				.on(new Date(),new PastTimeValidate())                  //校验是否是以前的时间
				.doValidate().result(ResultCollectors.toSimple());
		System.out.println(ret);
		
	}

	

}
